namespace NHCodeFirst.FluentMapper
{
    using System;
    using HbmModel;

    public class JoinedSubClassMapper<TEntity> : ClassMapperBase<JoinedSubClassMapper<TEntity>>
    {
        private Class @class;
        internal JoinedSubClassMapper(Class @class) : base(@class)
        {
            child = this;
            @class = @class;
        }

        public JoinedSubClassMapper<TEntity> MapKeys(Action<KeyMapper<TEntity>> mapper)
        {
            if (@class.Key == null)
                @class.Key = new Key();
            mapper(new KeyMapper<TEntity>(@class.Key));
            return this;
        }
    }
}